package com.example.art_cloud_backend.model.enums;

import cn.hutool.core.util.ObjectUtil;
import lombok.Getter;

import java.util.Objects;

/**
 * @Author caiya
 * @Description 用户角色枚举类
 * @Version 1.0
 */
@Getter
public enum PictureReviewStatusEnum {
    REVIEWING("待审核", 0),
    PASS("通过", 1),
    REJECT("拒绝", 2);

    private final String label;
    private final Integer value;

    PictureReviewStatusEnum(String roleName, Integer roleValue) {
        this.label = roleName;
        this.value = roleValue;
    }

    /**
     * 根据枚举值 获取 枚举对象
     *
     * @param value 枚举值
     * @return 枚举对象
     */
    public static PictureReviewStatusEnum getEnumByValue(Integer value) {
        if (ObjectUtil.isEmpty(value)) {
            return null;
        }
        for (PictureReviewStatusEnum userRoleEnum : PictureReviewStatusEnum.values()) {
            if (Objects.equals(userRoleEnum.getValue(), value)) {
                return userRoleEnum;
            }
        }
        return null;
    }

}
